 <?php

 /**
 * ErrorController
 */
 class ErrorController extends Zend_Controller_Action
 {

     public function errorAction()
     {

         // Retrieve the type of error
         $errors = $this->_getParam('error_handler');

        // Produce an appropriate message based on the error type
         switch ($errors->type) {
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
             // 404 error
             $this->getResponse()->setHttpResponseCode(404);
             $this->view->message = 'The page could not be found';
             break;
             default:
             // Application error
             $this->getResponse()->setHttpResponseCode(500);
             $this->view->message = 'An application error has occurred';

            break;
         }

         // Pass the environment to the view script
         $this->view->env = $this->getInvokeArg('env');

        // Pass the exception object to the view
         $this->view->exception = $errors->exception;

         // Pass the request to the view
         $this->view->request = $errors->request;
     }
 }

 ?>